package com.longrise.android.byjk.plugins.dealsituation.course.video2.params;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.Arrays;

/**
 * Created by godliness on 2017/7/13.
 * 有关于学习相关，跳转界面，传递数据结构
 * <p>
 * ！！！请勿做任何改动 如果修改参数需要根据情况写入序列化！！！
 */

public final class VideoParams implements Parcelable {

    public VideoParams() {
    }

    /**
     * ---------------------以下为课件通用类型--------------------------
     * 课程id
     */
    public String mCourseId;

    /**
     * 学号
     */
    public String mStudentNo;

    /**
     * 配置节点
     */
    public String mPathNo;

    /**
     * 课件id
     */
    public String mCwid;

    /**
     * 课件name
     */
    public String mCwidName;

    /**
     * 进入学习界面时网络状态
     */
    public boolean mDataNet;

    /**
     * 是否有课后习题
     */
    public boolean mHasqa;

    /**
     * 是否已完成
     */
    public boolean mFinish;

    /**
     * 课件是否通过 用于区分有课后习题情形
     */
    public boolean mVideopass;

    /**
     * 当前课件在列表中索引位置
     */
    public int[] mCwidLocal;

    /**
     * 课件类型
     */
    public String mCwidStyle;

    /**
     * 课程类型
     */
    public int mGroupType;

    /**-------------------------以上为课件通用类型------------------------*/


    /**
     * -------------------------以下为兼容  【模拟测试题】---------------------------------------
     * 学习记录id 模拟测试题
     */
    public String recordid;

    /**
     * 课件学习状态 模拟测试题
     */
    public int istest;

    /**-------------------------以上为兼容  【模拟测试题】-----------------------------------------------------*/

    /**
     * -----------------------以下兼容培训证书 培训记录表----------------
     * 报名信息id
     */
    public String mTrainsiqnupid;

    public int mType;


    public String mVideoPath; //视频路径 兼容公司的演示视频播放 xkj20171127

    /**
     * -----------------------以上兼容培训证书 【培训记录表】----------------
     */

    protected VideoParams(Parcel in) {
        mCourseId = in.readString();
        mStudentNo = in.readString();
        mPathNo = in.readString();
        mCwid = in.readString();
        mCwidName = in.readString();
        mDataNet = in.readByte() != 0;
        mHasqa = in.readByte() != 0;
        mFinish = in.readByte() != 0;
        mVideopass = in.readByte() != 0;
        mCwidLocal = in.createIntArray();
        mCwidStyle = in.readString();
        mGroupType = in.readInt();
        recordid = in.readString();
        istest = in.readInt();
        mTrainsiqnupid = in.readString();
        mType = in.readInt();
        mVideoPath = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(mCourseId);
        dest.writeString(mStudentNo);
        dest.writeString(mPathNo);
        dest.writeString(mCwid);
        dest.writeString(mCwidName);
        dest.writeByte((byte) (mDataNet ? 1 : 0));
        dest.writeByte((byte) (mHasqa ? 1 : 0));
        dest.writeByte((byte) (mFinish ? 1 : 0));
        dest.writeByte((byte) (mVideopass ? 1 : 0));
        dest.writeIntArray(mCwidLocal);
        dest.writeString(mCwidStyle);
        dest.writeInt(mGroupType);
        dest.writeString(recordid);
        dest.writeInt(istest);
        dest.writeString(mTrainsiqnupid);
        dest.writeInt(mType);
        dest.writeString(mVideoPath);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<VideoParams> CREATOR = new Creator<VideoParams>() {
        @Override
        public VideoParams createFromParcel(Parcel in) {
            return new VideoParams(in);
        }

        @Override
        public VideoParams[] newArray(int size) {
            return new VideoParams[size];
        }
    };

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("mCourseId='").append(mCourseId).append('\'');
        sb.append(", mStudentNo='").append(mStudentNo).append('\'');
        sb.append(", mPathNo='").append(mPathNo).append('\'');
        sb.append(", mCwid='").append(mCwid).append('\'');
        sb.append(", mCwidName='").append(mCwidName).append('\'');
        sb.append(", mDataNet=").append(mDataNet);
        sb.append(", mHasqa=").append(mHasqa);
        sb.append(", mFinish=").append(mFinish);
        sb.append(", mVideopass=").append(mVideopass);
        sb.append(", mCwidLocal=").append(Arrays.toString(mCwidLocal));
        sb.append(", mCwidStyle='").append(mCwidStyle).append('\'');
        sb.append(", mGroupType=").append(mGroupType);
        sb.append(", recordid='").append(recordid).append('\'');
        sb.append(", istest=").append(istest);
        sb.append(", mTrainsiqnupid='").append(mTrainsiqnupid).append('\'');
        sb.append(", mType=").append(mType);
        sb.append('}');
        return sb.toString();
    }
}
